
function GetCameraState(a)
{

	flashpoint();

	var i,setting;
	
	printf('# API: GetCameraState(PName,PNameValue )');
	printf('# get the current state of the camera ');
	printf('# OUTPUT FORMAT ');
	printf('# PName [status] actual-value ');
	printf('# i.e. 4)actc[0] 600');
	printf('#  actc is the parameter name');
	printf('#  [0] indicates status returned is 0');
	printf('#  [5] indicates status returned in 5');
	printf('#  600 is the current state of the "actc" parameter');
	printf(' ');
	
	writeMenu('"GetCameraState"','"CMD"','"GetCameraState()"');
	writeVariables();
	printf('declare s: fposComm');
	printf('declare s: title0');
	
	printf('<br>','#**** OPEN FILE ****');
  	printf('outFile="/System/ZGState.txt"');
	writeFileOpen();

	printf('WriteLine(fd," API: GetCameraState(PName,PNameValue )")');
	printf('WriteLine(fd," get the current state of the camera ")');
	printf('WriteLine(fd," OUTPUT FORMAT ")');
	printf('WriteLine(fd," PName [status] actual-value ")');
	printf('WriteLine(fd," i.e. 4)actc[0] 600")');
	printf('WriteLine(fd,"  actc is the parameter name")');
	printf('WriteLine(fd,"  [0] indicates status returned is 0")');
	printf('WriteLine(fd,"  [5] indicates status returned in 5")');
	printf('WriteLine(fd,"  600 is the current state of the actc parameter")');
	printf(' ');
	

		printf('count=1');
		printf('LOOP:');
		printf('theType="UInt"');
		printf('fposComm=" "');
		
		for( i=1 ; i< a.length ; i++)
		{ 			
 	 			printf(" ");
 				printf('if count == ', i );
  	 			printf('param=',a[i].param);
  	 			
  	 			
  	 			if( a[i].fposComm == "GetProductInfo")
  	 				printf('fposComm = "GetProductInfo"');
  	 				
  	 			// write theType									
 				if( a[i].type == "String" || a[i].type=="DosName")
 					printf('theType="String"');
 				else if( a[i].type=="SInt" )
 					printf('theType="SInt"'); 					
 				else if( (a[i].type=="Enum List Hex") || (a[i].type=="Hex") || (a[i].type=="Fixed")  || (a[i].type=="BitMask"))
 					printf('theType="Hex"'); 					
 				
  	 			printf('title0="',a[i].desc,'"');
 				printf('end '); 			

				
		}// end of this HUGE for loop
		printf(' ');
		
// start to examine SetCameraState()
	printf('Wait(100)');

	printf(' WriteLine(fd," ")' );	
	printf(' WriteLine(fd,"*** ",title0," ***")' );
	printf(' if theType=="SInt"');
	printf(' goto case_SINT');
	printf(' end','<br>');

	printf(' if theType=="String"');
	printf(' goto case_STRING');
	printf(' end','<br>');
	
	printf(' ' );
	printf('CASE_UINT:');
	printf('uvar=0');
	printf('status=GetCameraState(param,uvar)' );
	printf('if theType != "Hex" ');
	printf('DisplayLine(count,")",param,"[",status,"] " , uvar )' );
	printf('WriteLine(fd,count,")",param,"[",status,"] " , uvar )' );	
	printf('end','<br>');
	
	printf('if theType == "Hex" ');
	printf('bvar=uvar');
	printf('DisplayLine(count,")",param,"[",status,"] " , bvar )' );
	printf('WriteLine(fd,count,")",param,"[",status,"] " , bvar )' );	
	printf('end','<br>');


	printf('goto CONTINUE');
	printf('# UINT finished  ***********************************');		
	printf(' ');
	printf('case_STRING:');
	printf('svar=" "');
	printf('status=GetCameraState(param,svar)' );
	printf('DisplayLine(count,")",param,"[",status,"] " , svar )' );
	printf('WriteLine(fd,count,")",param,"[",status,"] ", svar  )' );		
	printf('goto CONTINUE');
	printf('# STRING finished  *********************************');		
	printf(' ');	
	printf('case_SINT:');
	printf('ivar=0');
	printf('status=GetCameraState(param,ivar)' );
	printf('DisplayLine(count,")",param,"[",status,"] " , ivar )' );
	printf('WriteLine(fd,count,")",param,"[",status,"] ", ivar  )' );	
	printf(' ');	
	printf('CONTINUE:');
	printf(' ');
	
	printf("# a GetProductInfo call*****************************");
	printf(' if fposComm == "GetProductInfo"');
	printf(' WriteLine(fd,count,")for ",param," use GetProductInfo()")');
	printf(' end ');
	printf(' ');
	
	printf('if count<', a.length-1 );
	printf('count=count+1 ');
	printf('goto LOOP');
	printf('end');
	
	writeFileClose();
	printf('exitscript');

}

